#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

int main()
{
    int m, k, n, d;
    while (scanf("%d%d", &m, &n) != EOF)
    {
        if (m < n) { k = m; m = n; n = k; }
        d = m % n;
        while (d != 0)
        {
            n = d;
            m = n;
            d = m % n;
        }
        printf("%d\n", n);
    }


    return 0;
}